package safeCommitter.core.view.action;

/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

import org.eclipse.jface.action.Action;

import safeCommitter.core.view.dialogs.CompareResultDialog;
import safeCommitter.core.view.main.FailureTraceView;
import safeCommitter.core.view.main.SCViewUtils;

/**
 * Action to enable/disable stack trace filtering.
 */
public class CompareResultAction extends Action {
	private final FailureTraceView fView;

	public CompareResultAction(FailureTraceView view) {
		super("Compare"); //$NON-NLS-1$

		setDisabledImageDescriptor(SCViewUtils
				.getImageDescriptor("icons/dcompare.gif")); //$NON-NLS-1$
		setHoverImageDescriptor(SCViewUtils
				.getImageDescriptor("icons/compare.gif")); //$NON-NLS-1$
		setImageDescriptor(SCViewUtils.getImageDescriptor("icons/compare.gif")); //$NON-NLS-1$

		fView = view;
	}

	/*
	 * @see Action#actionPerformed
	 */
	@Override
	public void run() {
		CompareResultDialog dialog = new CompareResultDialog(fView.getShell(),
				fView.getFailedTest());
		dialog.create();
		dialog.open();
	}
}
